
DECLARE @Value VARCHAR(200)

SELECT @Value = KeyValue FROM HotelSetup
where SearchKey = 'RoomNumberPlanColumns'

SELECT * INTO #TEMP FROM DBO.iter_intlist_to_table_NO_Dummy(@Value)

update #TEMP
SET Number = NUMBER + 1
WHERE number > 6

declare @str varchar(1000)

SELECT @str= coalesce(@str + ',','') + CAST(a.Number AS VARCHAR)
FROM (SELECT DISTINCT number from #TEMP) a

Update HotelSetup
Set KeyValue = @str
where SearchKey = 'RoomNumberPlanColumns'