
use tempdb
go

-- Updating dependencies by module

CREATE PROCEDURE sample_sp AS
   SELECT * FROM doesnotyetexist
go
   
CREATE TABLE doesnotyetexist(nowitexists int NOT NULL)
go
   
sp_depends sample_sp   -- nothing displayed.
go

sp_refreshsqlmodule sample_sp 
go

sp_depends sample_sp   -- Now it does!
go

drop proc sample_sp
drop table doesnotyetexist


-- granting permissions to all objects in a schema
grant select on schema::payroll_procs to payroll_role