Was your doctor a regular doctor? Did you get tested for B12 prior to getting the shot?
Many people who are deficient in B12 will notice lack of energy. Similar with lack of Vitamin D. I'd recommend people in general go to their doctor and get a regular checkup including tests for B12/D.
If you aren't deficient in B12, then a B12 shot/pills won't do anything for you. If you are deficient, then you may notice more energy.
You can't out-exercise poor eating habits.