Search notes:
SQL Server: sys.sql_modules
sys.sql_modules
stores the definition of
object that are defined with SQL (such as a view or a
stored procedure).
select
sch.name sch,
obj.name obj_name,
obj.type obj_type,
-- obj.type_desc obj_type_desc,
mod.definition mod_definition,
obj.modify_date obj_mod_dt,
obj.object_id obj_id
from
sys.objects obj join
sys.sql_modules mod on obj.object_id = mod.object_id join
sys.schemas sch on obj.schema_id = sch.schema_id
where
lower(obj.name) = 'tq84_ect' and
lower(sch.name) = 'dbo'
-- object_id = object_id('nameOfObject');
;
TODO 2024-02-22: there are stored procedures whose definitions are null if selected with this statement.