select top 1 '2004C'+right(('000'+cast((right(id,4)+1) as varchar)),4) from tt where right(id,4) not in (select right(id,4)-1 from tt)
insert t select
(
select top 1 '2004C'+right(('000'+cast((right(id,4)+1) as varchar)),4) from tt where right(id,4) not in (select right(id,4)-1 from tt)
),'a','b'