You really should have a list of priorities when you step into the greenside bunker to play a bunker shot. This list - in order of importance - could look something like this...
1. Get the ball out on the first swing
2. Put the ball on the green
3. Get the ball close to the hole
4. Leave yourself with an uphill putt
5. Hole the bunker shot
... the variables being your skill level and the difficulty of the bunker shot.
I am going to provide a few secrets to playing great bunker shots that will help you attain the best possible scenario on the priority list.
Secret 1. Do not allow the face to turn over at and after impact
What does that mean? The face of the club needs to point at or even slightly right of the target at impact. If your face is square and closing at impact the club is going to slow and shut as it enters the sand leading to two potential results - the ball won't leave the bunker - or - the ball will come out left, low and fast leaving you with a long putt - if the ball should stay on the green. And obviously you will have no chance of holing it.
How do you keep the face square or open at impact? Either grip the club tightly with your right hand throughout the swing which will create a blocking action perfect for bunker shots, or feel like the face of the club points at the sky following impact. This will keep the ball starting on line which is a big part of getting the ball on the green, close to the hole, with a chance to go in.
Secret 2. Accelerate the club into the sand
You always want to accelerate the club into the sand, even on short bunker shots. Control the distance you want the ball to go by the length of the backswing, and always hammer that club into the sand under the ball to pop it up and out with some spin. So very simply... short bunker shot = short backswing and hammer the club into the sand - long bunker shot = long backswing and hammer the club into the sand.
Secret 3. Try to hole an inch of sand
Your goal should always be to hole your shot and an inch of sand with it. If you always take an inch of sand then it eliminates the chance of both a thin shot and a fat shot, as well as giving you consistency with regard to your feel. Control the distance not by altering how much sand you take, but rather by controlling the length of your backswing.
Secret 4. No surprise - practice
Find an hour, visit a facility with a bunker practice area, or drop some balls in the bunker of your home course an hour before dark one night and practice the previous 3 secrets. The best players in the world would rather have a bunker shot than almost any other lie around the green, because they know how to play it, and have a good chance of holing it. Just like you will if you follow my secrets.