hi
this is correct.
DECLARE @isql VARCHAR(MAX),
@dbname VARCHAR(64)
SET @dbname = 'TargetDatabase'
DECLARE c1 CURSOR FOR
SELECT modz.definition
FROM sys.sql_modules modz
LEFT OUTER JOIN sys.objects objz
ON objz.object_id = modz.object_id
WHERE type_desc IN ( 'SQL_SCALAR_FUNCTION', 'CLR_SCALAR_FUNCTION', 'CLR_TABLE_VALUED_FUNCTION',
'SQL_INLINE_TABLE_VALUED_FUNCTION', 'SQL_STORED_PROCEDURE', 'CLR_STORED_PROCEDURE',...