I am getting an error described in the title where my code looks like this:
declare @cols numeric(10,0), @sql numeric(10,0) select @cols = isnull(@cols + \', \'
You've declared @cols as numeric(10,0), but you're trying to assign text to it. Probably need to declare it as nvarchar(max).
P.s. by concatenating AmountPayd you're suppose to get a list of customers?