When out on the club ride today (65 miles) I was riding in the group at the back as we were working our way through the Clwydian valley.
On one of the hills, Another rider pointed out that you get more out of shape when you are out of the saddle going up hills. Apparently it gives you a little burst of energy, but you get tired very quickly. Staying in the saddle is easier to maintain and you give yourself a better workout.
We were all struggling up the hills though.
While there may be some truth in what he says, best not believe everything people tell you. The advice sounds like it comes from someone who doesn't actually know how to climb out of the saddle - you don't have to sprint just because you're out of the saddle.
Climbing seated is marginally more efficient than climbing out of the saddle provided you are using a comfortable cadence and the hill isn't too steep. Once the hill becomes very steep and/or your cadence drops significantly then there's nothing in it really so you should do what is comfortable for you. Some people prefer to stand up, some prefer to stay seated and grind away. But in order to know which is right for you you need to practice both. If you never climb out of the saddle and you try it while you're struggling up a hill then you'll probably decide that it's no better, worse even. If however you are comfortable climbing both ways then on any given hill you can decide what's right for you. What's right after a few easy miles might not be right after 50 draining miles.
I would recommend going out and intentionally climbing whole hills out of the saddle. I don't mean sprinting up them, which is what people generally end up doing when they first try it. You need to drop down a gear or two ('harder' gear) compared to what you'd use if you were seated and get into a rhythm. Most people will find a lower cadence is more comfortable when out of the saddle (once they've adapted to the technique).