This section appears, just over half way down:
WHEN @Data_Type IN ('uniqueidentifier') THEN 'COALESCE('''''''' + REPLACE(CONVERT(char(255),RTRIM(' + @Column_Name + ')),'''''''','''''''''''')+'''''''',''NULL'')'
Look at the conversion to CHAR (255), which means the value is populated with up to 255 characters. Change it to VARCHAR and it should be good, as it will not expose values ββwith spaces.
source share