Hi nauna,
Refer below sample query.
SQL
CREATE TABLE #Test (categoryname CHAR(1),productname VARCHAR(10))
INSERT INTO #Test VALUES('A','ABC')
INSERT INTO #Test VALUES('B','BCDE')
INSERT INTO #Test VALUES('A','B4u')
INSERT INTO #Test VALUES('B','ABC')
INSERT INTO #Test VALUES('C','BCDE')
INSERT INTO #Test VALUES('A','B4u')
SELECT t.*
FROM #Test AS t
JOIN (SELECT categoryname,NEWID() AS Random
FROM #Test
GROUP BY categoryname ) AS r
ON r.categoryname = t.categoryname
ORDER BY r.Random, t.productname
DROP TABLE #Test