If the {TestData}.[Id] column holds string values, you want @SelectedIds = "'a','b','c','d'" (notice each item is a SQL string - has single quotes around it).
If the {TestData}.[Id] column holds integer values, you want @SelectedIds = "1,2,3" (notice each item is an integer)
Hope this solves your issue.