Use sp_depends with deferred_name_resolution

Since procedures created using deferred name resolution dependency information are created at execution, a message is raised when sp_depends executes a procedure created with deferred name resolution but not yet executed.

sp_depends p
----------
The dependencies of the stored procedure cannot be determined until the first successful execution.
(return status = 0)

After the first successful execution, the dependency information is created and the execution of sp_depends returns the expected information.

For example:

 set deferred_name_resolution on
-----------------create procedure p as
select id from sysobjects
where id =1sp_depends p
------------
The dependencies of the stored procedure cannot be determined until the first successful execution.(return status = 0)exec p
id -----------
           1
(1 row affected)
(return status = 0)
sp_depends p
----------------

The object references in the current database.
object                       type
updated
         selected---------------------------- ------------------------ --------------
         ---------------- dbo.sysobjects                          system table  
           no
                      no(return status = 0)