SELECT Y.LeaderID FROM (

SELECT (SELECT ConsultantID FROM taBranchStructure AS X WHERE (X.PositionID = A.LeaderPositionID)) AS LeaderID
FROM taBranchStructure AS A
WHERE (A.ConsultantID = @nConsultantID)

UNION

SELECT (SELECT ConsultantID FROM taBranchStructure AS X WHERE (X.PositionID = A.LeaderPositionID)) AS LeaderID
FROM taBranchStructure AS A
WHERE (A.ConsultantID = (
  SELECT (SELECT ConsultantID FROM taBranchStructure AS X WHERE (X.PositionID = A.LeaderPositionID)) AS LeaderID
  FROM taBranchStructure AS A
  WHERE (A.ConsultantID = @nConsultantID)
))

UNION

SELECT (SELECT ConsultantID FROM taBranchStructure AS X WHERE (X.PositionID = A.LeaderPositionID)) AS LeaderID
FROM taBranchStructure AS A
WHERE (A.ConsultantID = (
  SELECT (SELECT ConsultantID FROM taBranchStructure AS X WHERE (X.PositionID = A.LeaderPositionID)) AS LeaderID
  FROM taBranchStructure AS A
  WHERE (A.ConsultantID = (
    SELECT (SELECT ConsultantID FROM taBranchStructure AS X WHERE (X.PositionID = A.LeaderPositionID)) AS LeaderID
    FROM taBranchStructure AS A
    WHERE (A.ConsultantID = @nConsultantID)
  ))
))

) AS Y WHERE (Y.LeaderID IS NOT NULL)