Last week, I did a little work to track down unused stored procedures in a large-ish SQL Server database. Searching for references in source code was interesting all by itself, but I also wanted to see which procs were referenced by other procedures. This is what I came up with:
select o1.name 'referencing proc', o2.name 'referenced proc' from sysdepends d, sys.objects o1, sys.objects o2 where d.id = o1.object_id and d.depid = o2.object_id and o2.type = 'P'