Hi try this code block,
CREATE TABLE YourTable (ID int,name varchar(20),salary money)
INSERT INTO YourTable (ID,name,salary)
VALUES
(1, 'raj',90),
(2,'ram', 23),
(3,'jeet',15 ),
(4,'neelu',20)
;WITH RecursiveCTE AS
(
SELECT TOP 1 ID, name,salary, salary as Total FROM YourTable ORDER BY ID asc
UNION ALL
SELECT YourTable.ID,YourTable.name,YourTable.salary,Total+YourTable.salary FROM
RecursiveCTE JOIN YourTable ON YourTable.ID = RecursiveCTE.ID + 1
)
SELECT * FROM RecursiveCTE OPTION (Maxrecursion 0)
Happy coding...