Hmm.... I guess it would help if you wrote the error message you got. But what attracted my attention was your sql:
exec dbo.mapping IDMAP
I guess this should be:
exec dbo.mapping :IDMAP
The colon is required to identify a parameter name, wich can later be passed to the Database:
query.SetParameter("IDMAP", idmap); <--- I don´t understand here.
Im not sure what it is, you dont understand. Please substantiate your question.
Query-Parameters are generally directly supported by the Database.
The application prepares your query against the Database Server and parameters can be set for each call to it.
Like this you avoid SQL-Injection and increase performance, if you have to call the same query with different parameters multiple times.