What should we report back if these conditions take place:
1 - The employee in question is a director?
2 - There are several directors at the same level?
Anyway, the idea would be to traverse the hierarchy one level at a time and stop the recursive part as soon as you have found the first 'IsDirector'.
with C1 as (
select employeeid, fname, lname, IsDirector, employeeid as R, IsDirector as FoundDir
from employees
where employeeid = @employeeid
union all
select C.employeeid, C.fname, C.lname, C.IsDirector, P.R, max(IsDirector) over(partition by P.R)
from C1 as P inner join employees as C on C.ReportsTo = P.employeeid
where P.FoundDir = 0
)
select *
from C1
where IsDirector = 1;
We can adapt it after you have posted DDL and sample data.