How to search for text in a SQL Server stored procedure, function, or view?

less than 1 minute read

You can use the following T-SQL query to search for text in a SQL Server stored procedure, function, or view.

Code:

SELECT	DISTINCT o.name AS Object_Name, o.type_desc
FROM		sys.sql_modules m
INNER   JOIN	sys.objects o ON m.object_id = o.object_id
WHERE		m.definition Like '%search term%'
Fig 1. Search text in stored procedure, function and view using t-sql

Leave a comment