IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[mps_debug_searchsthfrom_1db_proc]') AND type = 'P')
DROP PROCEDURE [dbo].[mps_debug_searchsthfrom_1db_proc]
GO
create procedure [dbo].[mps_debug_searchsthfrom_1db_proc]
@WHAT  varchar(1000),
@db varchar(1000) 
as
begin

SELECT ROUTINE_NAME proc_name,charindex(@WHAT,ROUTINE_DEFINITION) char_index ,ROUTINE_DEFINITION content,'sp_helptext '+ROUTINE_NAME veiw_sql  
FROM INFORMATION_SCHEMA.ROUTINES   
WHERE ROUTINE_DEFINITION LIKE '%'+@WHAT+'%'   
AND ROUTINE_TYPE='PROCEDURE'  
and SPECIFIC_CATALOG like '%'+@db+'%' 



end