So a few minutes ago, I had a random thought. sys.dm_sql_referenced_entities(), which is the fundamental basis of sp_helpExpandView, works on an assortment of objects, not just views. Hmmm… I wonder… let’s run it against a stored procedure? BOOM! I had a list of all objects referenced in that proc!!! And of course, all of the views that were referenced were also expanded out.
Well that’s nifty! You can use sp_helpExpandView to quickly assess objects referenced by a stored procedure!
Yep – I planned that feature… sure did! Hah!
Check out the latest version here: sp_helpExpandView