Use Join to get the expected result for SQL Server 2005 plus.
create table words (id integer, word varchar(20)); insert into words values (1 ,'my'), (2 ,'name'), (3 ,'is'), (4 ,'joseph'), (5 ,'and'), (6 ,'my'), (7 ,'father'), (8 ,'name'), (9 ,'is'), (10,'brian'); SELECT A.Id , C.word AS PrevName , A.word AS CurName , B.word AS NxtName FROM words AS A LEFT JOIN words AS B ON A.Id = B.Id - 1 LEFT JOIN words AS C ON A.Id = C.Id + 1 WHERE A.Word = 'name'
Result:

Fiddler Demo
Saravana kumar
source share