This is a T-SQL code snippet I find myself using regularly to find all references to a particular field or table, or search for comments from a particular date. It essentially allows you to search for a keyword in all of the definitions for stored procedures, functions (scalar or table-valued), and views. It uses some of the built-in methods SQL Server provides for obtaining metadata, which are essentially simplified views of the data contained in system tables like sysobjects and syscolumns. I know this T-SQL script works on SQL Server 2005 & SQL Server 2008, but don't know if the methods it is dependent on were available on previous versions.
DECLARE @Keyword varchar(64)
SET @Keyword = '%keyword%'
(
SELECT [ROUTINE_TYPE] AS 'Type', [SPECIFIC_NAME] AS 'Name'
FROM INFORMATION_SCHEMA.ROUTINES
WHERE [ROUTINE_DEFINITION] LIKE @Keyword
UNION
SELECT 'VIEW' AS 'Type', [TABLE_NAME] AS 'Name'
FROM INFORMATION_SCHEMA.VIEWS
WHERE [VIEW_DEFINITION] LIKE @Keyword
)
ORDER BY [Type], [Name]
Here is an example of the results of the script: