declare @Tbl table(sal int)

insert into @Tbl(sal) values(12),(15),(20),(25),(8),(20),(18),(10)

declare @TopNthSal int

set @TopNthSal = 3

select distinct * from @Tbl order by sal desc

select max(sal) as 'N-Highest' from @Tbl where sal not in ( select distinct top(@TopNthSal-1) sal from @Tbl order by sal desc )

select min(sal) as 'N-Lowest' from @Tbl where sal not in ( select distinct top(@TopNthSal-1) sal from @Tbl order by sal )

insert into @Tbl(sal) values(12),(15),(20),(25),(8),(20),(18),(10)

declare @TopNthSal int

set @TopNthSal = 3

select distinct * from @Tbl order by sal desc

select max(sal) as 'N-Highest' from @Tbl where sal not in ( select distinct top(@TopNthSal-1) sal from @Tbl order by sal desc )

select min(sal) as 'N-Lowest' from @Tbl where sal not in ( select distinct top(@TopNthSal-1) sal from @Tbl order by sal )