﻿-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date, ,>
-- Description:	<Description, ,>
-- =============================================
CREATE  FUNCTION [dbo].[CercaTestoInSP]
(
	-- Add the parameters for the function here
	@Testo varchar(255)
)
RETURNS @pippo TABLE 
(
	-- Add the column definitions for the TABLE variable here
	ObjectSQL varchar(255)
)
AS
BEGIN
	-- Declare the return variable here
	DECLARE @ValoreParametro VARCHAR(50)
	INSERT INTO @pippo
	select obj.name 
	from sys.sql_modules sqlmod 
	inner join sys.objects obj
		on sqlmod.object_id = obj.object_id
	where definition like '%' + @Testo + '%'
	RETURN 
END