Utilizza diverse ROW_NUMBER clausole per colonna e scegli quella pertinente:
....
ROW_NUMBER() OVER (ORDER BY [Column1]) as rn1,
ROW_NUMBER() OVER (ORDER BY [Column2]) as rn2,
ROW_NUMBER() OVER (ORDER BY [Column3]) as rn3,
ROW_NUMBER() OVER (ORDER BY [Column4]) as rn4
....
O utilizzare un'espressione CASE. Nota:tutti i tipi di dati devono essere compatibili
ROW_NUMBER() OVER (ORDER BY CASE @sort
WHEN 1 THEN [Column1]
WHEN 1 THEN [Column2]
WHEN 1 THEN [Column3]
...
END
O Se vuoi davvero un numero di riga arbitrario, procedi come segue:
ROW_NUMBER() OVER (ORDER BY (SELECT 1)) as rn