Skip to content

SQL - SQL Server - Search for Text Within Stored Procedures

Source: sql-snippets/search-stored-procedures.md at main · count/sql-snippets (github.com)

Description

Often you’ll want to know which stored procedure is performing an action or contains specific text. Query will match on comments.

Snippet ✂️

SELECT name
FROM   sys.procedures
WHERE  Object_definition(object_id) LIKE '%strHell%'

Usage

SELECT name
FROM   sys.procedures
WHERE  Object_definition(object_id) LIKE '%blitz%'

Output:

name
sp_BlitzFirst
sp_BlitzCache
sp_BlitzWho
sp_Blitz
sp_BlitzBackups
sp_BlitzLock
sp_BlitzIndex

Reference


Backlinks:

list from [[SQL - SQL Server - Search Stored Procedures]] AND -"Changelog"