SQL: trouver l'écart dans la séquence

WITH CTE_CheckRegister (AccountNumber, CheckNumber, NextCheckNumber)
AS
(
   SELECT AccountNumber,
          CheckNumber,
          Lead(CheckNumber, 1) OVER (PARTITION BY AccountNumber ORDER BY CheckNumber) NextCheckNumber
   FROM @CheckRegister
)
SELECT   AccountNumber,
         CASE
            WHEN NextCheckNumber is NULL THEN CheckNumber
            WHEN (CheckNumber = NextCheckNumber - 1) THEN CheckNumber
            ELSE CheckNumber + '***'
         END as CheckNumber
FROM     CTE_CheckRegister
ORDER BY AccountNumber, CheckNumber
Anxious Alligator