Hi,
Though sp_depends 'proc_name' displays all the tables which are part of the procedure but if the tables are part of dynamic query it never appears. Is there anyway to get the details?
I mostly use this query
SELECT DISTINCT p.name AS proc_name, t.name AS table_name
FROM sys.sql_dependencies d
INNER JOIN sys.procedures p ON p.object_id = d.object_id
INNER JOIN sys.tables t ON t.object_id = d.referenced_major_id
where p.name = 'proc_name'
ORDER BY proc_name, table_name