Searching a SQL Server database’s sys.comments table has long been a
quick way to find stored procedure usage of another database, table, or
column. Likewise, clicking “view dependencies”
on a table is a quick way to find the opposite: which stored procedures (on the
local db) refer to that table. I
recently came across a scenario where neither met my needs, so I had to expand
the capabilities of the former. The
limitation of the first approach is parsing the text field to find multiple
items. CHARINDEX and SUBSTRING functions
only get you to the first, and looping can be incorrect as line breaks may
occur haphazardly mid-text.