Your problem is that @pEmployeeIds exists in the stored procedure, not in the batch executed by DYNAMIC PIVOT.
The solution: embed the value of @pEmployeeIds in the string passed in, and split that embedded value not the variable which exists outside.
Tom