Not sure what you want, but you can use
Pivot[
^] table. Have a look at sample code:
DECLARE @tmp TABLE([Name] VARCHAR(30), Comp VARCHAR(30), DOJ INT)
INSERT INTO @tmp ([Name], Comp, DOJ)
VALUES('Kris', 'Aa', 2010),
('Naik', 'Bb', 2013),
('Kris', 'Cc', 2011),
('Nana', 'Dd', 2014)
SELECT [Name], [1], [2]
FROM (
SELECT ROW_NUMBER() OVER(PARTITION BY [Name] ORDER BY [Name], DOJ) AS RowID, [Name], DOJ
FROM @tmp
) AS DT
PIVOT (MAX(DOJ) FOR [RowID] IN([1], [2])) AS PT
Result:
Name 1 2
Kris 2010 2011
Naik 2013 NULL
Nana 2014 NULL
More:
Simple Way To Use Pivot In SQL Query[
^]
Pivots with Dynamic Columns in SQL Server 2005[
^]