Assuming you only want the remark to show on the last row, try:
SELECT
STID,
MARKS1 As MARKS,
CASE WHEN MARKS2 Is Null And MARKS3 Is Null THEN REMARK END As REMARK
FROM
dbo.student
WHERE
MARKS1 Is Not Null
UNION ALL
SELECT
STID,
MARKS2 As MARKS,
CASE WHEN MARKS3 Is Null THEN REMARK END As REMARK
FROM
dbo.student
WHERE
MARKS2 Is Not Null
UNION ALL
SELECT
STID,
MARKS3 As MARKS,
REMARK
FROM
dbo.student
WHERE
MARKS3 Is Not Null
;
If you want to preserve the output order:
WITH cte As
(
SELECT
STID,
1 As SEQ,
MARKS1 As MARKS,
CASE WHEN MARKS2 Is Null And MARKS3 Is Null THEN REMARK END As REMARK
FROM
dbo.student
WHERE
MARKS1 Is Not Null
UNION ALL
SELECT
STID,
2 As SEQ,
MARKS2 As MARKS,
CASE WHEN MARKS3 Is Null THEN REMARK END As REMARK
FROM
dbo.student
WHERE
MARKS2 Is Not Null
UNION ALL
SELECT
STID,
3 As SEQ,
MARKS3 As MARKS,
REMARK
FROM
dbo.student
WHERE
MARKS3 Is Not Null
)
SELECT
STID,
MARKS,
REMARK
FROM
cte
ORDER BY
STID,
SEQ
;