It's a bit tricky on the stored procedure part since you can have indefinite number of tags as input. My suggestion is to use
dynamic SQL[
^] in creating the query. Basically, you put all your tags on the input parameter on your stored procedure, do the necessary parsing and string manipulation on the parameter, and then integrate in on the WHERE clause of your query. The link has examples provided. You might want to check it out.