Here’s a quick code snippet to search through all the stored procedures in a SQL Server database for a keyword:
SELECT o.object_id, o.name, SQLM.Definition FROM sys.objects o LEFT OUTER JOIN sys.SQL_modules SQLM ON o.object_id = SQLM.object_id WHERE SQLM.definition LIKE '%incident%User2%' AND o.type='P' ORDER BY o.name
Just replace the ‘SQLM.definition LIKE’ with a keyword that you are searching for and you’ll get back a list of stored procedures that contain that keyword.