DECLARE @temp TABLE (ID INT, Value1 VARCHAR(20), Value2 VARCHAR(20))
INSERT INTO @temp
(ID, Value1, Value2)
VALUES
(1, 'Rajan', NULL),
(3, 'Vijayan', NULL),
(1, NULL, 'Ravi'),
(3, NULL, 'sudeep'),
(2, 'kumar', NULL),
(2, NULL, 'venkat')
SELECT DISTINCT
ID,
(SELECT Value1 FROM @temp t2 WHERE t2.ID = t.ID AND Value1 IS NOT NULL) AS 'Value1',
(SELECT Value2 FROM @temp t2 WHERE t2.ID = t.ID AND Value2 IS NOT NULL) AS 'Value2'
FROM
@temp t
Pls Refer this Example.. may this help You...Try this..