Optimize a SQL query
Quite convoluted but should work and return the 2 rows with values below the @repid, the row with @repid and the 2 rows with values above the @repid (assuming that id is a unique key).

If there are less than 2 values below or above, the query will get more from the other side. In total a maximum of 5 rows will be returned. 

Note: the ORDER BY is needed. All three of them (not the 4th, that's only if you need the results in specific order):

with a as
  ( select top (4) 
        *, rnk = row_number() over (order by id desc) 
    from tblLookups
    where Id &lt; @repID
    order by id desc
  ),
b as
  ( select top (5) 
        *, rnk = row_number() over (order by id) - 1
    from tblLookups
    where Id &gt;= @repID
    order by id
  ),
c as 
  ( select top (5) *
    from
      ( select *
        from a
      union all
        select *
        from b
      ) x
    order by rnk 
  )
select *
from c
order by id ;


Tested at SQLfiddle.