-- Collection of code snippets by Arne Vajhøj 
-- (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and 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
