Hi Heta,
Please find below example.
We can use Temporary tables instead of Cursors.
DECLARE @MaxCount INT
DECLARE @Count INT
SET @Count =1
CREATE TABLE #TempTable
(
Id INT Identity(1,1),
KeyWord VARCHAR(100)
)
SELECT @MaxCount =MAX(ID) FROM #TempTable
WHILE (@Count < = @MaxCount)
BEGIN
SET @Count= @Count+1;
END