There's a book that I like that addresses the question.
Rueben Fine, "The Ideas Behind Chess Openings."
It's available for free download online. He stresses the need to understaning the logic underlying various openings in order to cope with deviations/variations.
You order used copies of it fairly cheap at AbeBooks.com.
This book had an enourmous effect on my chess playing. I'd played as a kid and learned a few things, I'd read a lot of books in high-school and learned a little more, but when I read this book, it really helped a lot.
It explains several of the more popular openings, and at least a few of the less popular ones. And it explains, move by move, why that move was made.
Most opening books show the moves, but do little to explain *why* that's the best move. This one, however, explains the why - and that's what helped me so much.
I'm not a hot-shot chess player, and I don't try to memorize openings. But reading through (and playing along with) the openings in this book will help with the original posters problem. It did for me.
You must understand basic opening principles in order to be able to exploit your opponent's deviations in the opening. I found Nimzovitch's advice and analysis in "My System" very helpful in this regard, with his emphasis on gaining tempi in the opening.