Hi you can try like this,
CREATE FUNCTION Splitstring (@Input NVARCHAR(MAX),
@Character CHAR(1))
RETURNS @Output TABLE (
Item NVARCHAR(1000))
AS
BEGIN
DECLARE @StartIndex INT,
@EndIndex INT
SET @StartIndex = 1
IF Substring(@Input, Len(@Input) - 1, Len(@Input)) <> @Character
BEGIN
SET @Input = @Input + @Character
END
WHILE Charindex(@Character, @Input) > 0
BEGIN
SET @EndIndex = Charindex(@Character, @Input)
INSERT INTO @Output
(Item)
SELECT Substring(@Input, @StartIndex, @EndIndex - 1)
SET @Input = Substring(@Input, @EndIndex + 1, Len(@Input))
END
RETURN
END
GO
CREATE FUNCTION [dbo].[Func_1] (@ListNum AS NVARCHAR(MAX))
RETURNS @t TABLE (
col_1 NVARCHAR(MAX))
AS
BEGIN
INSERT @t
SELECT p.col1
FROM dbo.Splitstring(@ListNum, ',') s
JOIN Table_Name t
ON t.col2 = s.Item
RETURN
END
DECLARE @var VARCHAR(100)='1,2,3,4'
SELECT *
FROM dbo.Func_1(@var)
Introduce one more function called split string. It will return the comma separated list as a table. Join the comma separated table with your actual table. This will gives the result.