Query to Find Table used in Stored Procedures

SELECT DISTINCT objects.name, objects.type,
comments.text proc_defintion
FROM syscomments comments
INNER JOIN sys.objects objects
ON comments.id=objects.object_id
WHERE comments.text LIKE ‘%tbl_Batch_Recipe_Ingredient_Record%’
AND objects.type=’P’

multiple references,

https://blog.sqlauthority.com/2006/12/10/sql-server-find-stored-procedure-related-to-table-in-database-search-in-all-stored-procedure/

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.