Andy Jarrett // Code. Develop. Manage.

Searching MSSQL database for a Stored Proc by name or T-SQL definition

These two T-SQL scripts use an undocumented stored procedure, sp_MSforeachdb, to search through all the databases on a server. Im using it here to look Stored Procedure - rather than trying to think where it is. Don't forget with code like this it is using undocumented code so at any point (update/upgrade) it might stop working as-is:

Searching MSSQL database for a Stored Proc by name:

Searching MSSQL database for a Stored Proc by T-SQL Definition:

I’m here, learning and working away. If you liked this content and want to keep me going, consider buying me a coffee.
Your support keeps this site running and the coffee brewing! ☕️