|This is NOT a good design for your primary key, a PK should be stupid and not convey any information.
Create a table variable and fill it with all possible numbers between the range you want to test, then select from that table where the PK is not in your Distributor table.
SET @bottom = 2000
SET @Top = 6000
DECLARE @Tbl TABLE(Code VARCHAR(20))
SET @Count = 1
WHILE @Count < @Top
SET @Str = 'SL' + RIGHT('000000000'+CAST(@Count + @bottom AS VARCHAR(10)),8)
INSERT @Tbl(Code) VALUES (@Str)
SET @Count = @Count + 1
WHERE Code NOT IN (SELECT PD FROM TableBame)
Never underestimate the power of human stupidity