Fixed a bug;
Your generation sproc was ignoring the schema when using "EXEC sp_helptext @ProcedureName". Added below to fix the issue.
DECLARE @abc VARCHAR(MAX)
SET @abc = @RoutineSchema + '.' + @ProcedureName
INSERT INTO @StoredProcsDefinitionTable
(
ProcedureLine
)
EXEC sp_helptext @abc
Good article but It does not apply what we're trying to do.