Get all stored procedures that contain specific text in SQL Server

Today I had to find all procedures where two table were referenced. Also I had to Prioritise them in order to work on the most used procedure first.

After searching the web I found a few snipets of code here and there and put the following together.

Note: The query won’t return procedures that have not been executed since the last restart.

Here is part of the join clause, adapt as neccessary.

A.ROUTINE_DEFINITION LIKE  ''%AccountManagement%''


A.ROUTINE_DEFINITION LIKE  ''%LTCDB_admin.tbl_Sales_Contacts%''

Here is the complete queryRead More »