-- Collection of code snippets by Arne Vajhøj 
-- posted to eksperten.dk, usenet and other places (2002-now) 
CREATE PROCEDURE usp_test AS
SELECT * FROM t1;
GO

EXEC usp_test
GO

SP_DEPENDS 'dbo.usp_test'
GO

SELECT DISTINCT referenced_schema_name,referenced_entity_name,referenced_minor_name
FROM sys.dm_sql_referenced_entities('dbo.usp_test','OBJECT')
GO

DROP PROCEDURE usp_test
GO
