NTILE

Divides the partition up into N buckets specified in the argument. If a row doesn't divide evenly, (aka there is a remainder), all those records will get evenly spread across the buckets starting with bucket 1 and then 2.

(The above description feels abit iffy - or it might be implementation dependent so please read docs)

SELECT 
	ColName1,
	ColName2,
	ColName3,
	NTILE(27) OVER (PARTITION BY ColName1 ORDER BY ColName1, ColName2) AS NTileCol
FROM SchemaName.TableName
	ORDER BY ColName1, ColName2