• Issues with different white space characters is a pain. You just need to use the CHAR/NCHAR function in the REPLACE, like this:

    DECLARE @data NVARCHAR(MAX) = 'EXEC Proc_gen' + CHAR(9) + '@PsID=12, @kID=-1, @ID=3183';

    SELECT @data AS theData ,

    REPLACE(CHAR(9), REPLACE(@data, ' ', '')) AS dataNoSpaces;

    This one does both the Tab and the space.