Here is simple example to return records in Random Order. Example if you have rank 1,2,3,4,5…. Instead of using rank field in Ascending or descending order you wish you return in Random order use newid as shown below
1 2 3 4 5 | CREATE PROCEDURE [dbo].[cities_in_country_random] (@country char(20), @n int) AS select top (@n) * from cities where country = @country order by rank1 desc, newid() |