I ran my code over millions records, no problem ..too fast
Play fair, this is your code which you posted originally ...
The problem is, missing records on sequence don't appear, It will appear just one!
SELECT missing = T.id + 1
FROM dbo.#tb_temporaria T
WHERE T.id BETWEEN 0 AND 999
AND NOT EXISTS
(
SELECT 1
FROM dbo.#tb_temporaria T2
WHERE T2.id = T.id + 1
);