Yesterday refers to time in the past. If the headache has passed, you no longer have it:
I had a headache yesterday.
If your headache began yesterday and you still have it:
I have had a headache since yesterday.
Let's say you've acted grumpily towards someone and you want to apologize:
I'm sorry. I have had a bad headache all day.
You still have the headache. It began in the past (perhaps this morning) and has persisted.
Merely a causal connection between a past event and the present is not sufficient grounds to use the present perfect. If there is a time phrase relegating the action to the past, you cannot use the present perfect in that clause. If the time phrase excludes the present, the present perfect cannot be used in that clause.
He robbed a bank five years ago. And now he is in prison.
He robbed a bank early this morning, and he will go to prison for it.
He robbed a bank in his youth and he went to prison for it.
But contemplate this:
You have robbed a bank and now you are going to prison.
There is no time phrase relegating the robbery to the past, no time phrase which excludes the present; the speaker, by choosing the present perfect, is expressing a relationship of the past event to the present.
Here's how you might translate it on a semantic level:
He robbed a bank ~ he was a bank robber
He has robbed a bank ~ he is a bank robber