PATIDs is a string, not a list of ints. You need to split the string first then check fo IN. I would also suggest removing spaces from your PATIDs to make the split easier as there won't be a need to trim (eg GetPatientList(1002,'1001,1002,1004'))
See this post for creating a function that will split your string and then allow you to use the IN clause
https://stackoverflow.com/a/11105413/853295
Or this
http://vyaskn.tripod.com/passing_arrays_to_stored_procedures.htm
EDIT - Using Method 2 from the second link would result in something like this:
CREATE PROC dbo.GetPatientList
(
PATIDs varchar(255)
)
AS
BEGIN
SET NOCOUNT ON
CREATE TABLE #TempList
(
PatientBasicId int
)
DECLARE PATIDs varchar(10), @Pos int
SET PATIDs = LTRIM(RTRIM(PATIDs))+ ','
SET @Pos = CHARINDEX(',', PATIDs, 1)
IF REPLACE(PATIDs, ',', '') <> ''
BEGIN
WHILE @Pos > 0
BEGIN
SET PATIDs = LTRIM(RTRIM(LEFT(PATIDs, @Pos - 1)))
IF PATIDs <> ''
BEGIN
INSERT INTO #TempList (PatientBasicId) VALUES (CAST(PATIDs AS int)) --Use Appropriate conversion
END
SET PATIDs = RIGHT(PATIDs, LEN(PATIDs) - @Pos)
SET @Pos = CHARINDEX(',', PATIDs, 1)
END
END
SELECT pb.`PatientBasicId`, concat(concat(pb.`PatientFirstName`, ' '), concat(pb.`PatientLastName`, '')) as PatientName
FROM patientchfbasicdata pb
JOIN
#TempList t
ON pb.`PatientBasicId` = t.PatientBasicId
END
GO
And you can call the stored proc in SQL like
exec GetPatientList '1001,1002,1004'