First, the fact that you lack confidence is not bad--it's actually a good sign, because it means you understand enough about what it means to be competent to have doubts about how competent you are. I completely empathize with your situation, because I cycled into and out of the same state for a couple of years.
One thing you need to realise is that for most programmers, it's not even desirable to be as good as Dennis Ritchie or James Gosling. If you were, you'd be flat miserable in at least 85% of the jobs out there, because the idea that all programmers or most programmers or even a significant fraction of programmers are working toward that level of proficiency is a fiction. So most teams you will be on will not value the things you would need to have a high level of mastery of to be at that level. This means that, at a minimum, a significant portion of your hard-won skills will go unused. But more likely you will find yourself coming into conflict with teams whose basic coding phiosophy is diametrically opposed to yours.
So, if the team you are on remotely values good practice, consider whether you are going to be jumping out of the frying pan into the fire, as it were. It's nearly impossible to know exactly what the real coding practices are in a team you're joining until you're actually on the job, no matter how careful you are in the interview.
This is not to say you shouldn't be interviewing. Being able to ace an interview is in itself a confidence-builder. About 3 years ago, I interviewed for one of the top consulting firms in my field and didn't get the job. But I did get a good understanding of what it takes to be hired into that kind of position, and two years later I interviewed for them again. This time, I aced the interview and was offered the job. Sadly, for reasons beyond either party's control I had to turn it down, but knowing I had progressed that much in 2 years really helped my confidence.
That brings me to my last point--where you are today is not where you will be in 1,3, or 10 years. So keep working on the skills you value for you, and then seek a team that will allow you to exercise those skills. And keep trying. Just because you fail to get onto that team today doesn't mean that you won't get onto that team next year, or the one after that. And looking at it that the team has to be right for you, not just vice versa, will also take some of the nerves out of the situation.
I can crack interviews, that is not a problem, but I don't have confidence at all.
<-- this doesn't make sense to me. What do you mean by the "I can crack interviews" part - having confidence allows me to do well in interviewing. I'm not sure how someone can do well interviewing without it, to be honest.