Based on my understanding, you have a stored proc with those "if" constructs that acts as source, you want to have a CSV format flat file as destination based on each condition.
I suppose, those tbls have different metadata, you'd want to use script component to capture result set into a datatable and based on file name condition, write it to a flat file