Display local variable in while loop

There are two extensions of RAISERROR that may help:

To write it to the error log:

DECLARE @msg NVARCHAR(1000) = N''
RAISERROR(@msg, 16, 1) WITH LOG;

To display it in the messages tab in "real time":

DECLARE @msg NVARCHAR(1000) = N''
RAISERROR(@msg, 16, 1) WITH NOWAIT;

You could write the value to a table. Something like

create LogTable(Counter int, When datetime);

You can query this table when you need to see the progress.

If you don't want to pollute a production database with this it could be created in TempDB. Note I do not mean create a #temp table. That would be visible to the backup job only. I mean a "real" table but in tempdb. It would be dropped on instance restart so appropriate management routines must be put in place.