This will convert your comma delimited string to one column, hope this will help you
ALTER FUNCTION [dbo].[split] (@p_ids VARCHAR(8000))
RETURNS @Ids TABLE (Ids BIGINT)
AS
BEGIN
IF @p_ids IS NULL
BEGIN
RETURN
END
DECLARE @id_str VARCHAR(15)
DECLARE @l_str VARCHAR(8000)
DECLARE @pos INT
SET @l_str = @p_ids
SET @pos = CHARINDEX(',', @l_str)
WHILE @pos > 0
BEGIN
SET @id_str = RTRIM(LTRIM(SUBSTRING(@l_str, 1, @pos-1)))
INSERT INTO @Ids (Ids) VALUES (@id_str)
SET @l_str = LTRIM(RTRIM(SUBSTRING(@l_str, @pos+1, 8000)))
SET @pos = CHARINDEX(',', @l_str)
END
SET @id_str = LTRIM(RTRIM(@l_str))
INSERT INTO @Ids (Ids) VALUES (@id_str)
RETURN
END