Bunker-play techniques change with the type of sand out of which you are playing.
First, don't be afraid of the bunkers. Depending on your ability level, the main thing is to get the ball out of the bunker in one stroke.
If the sand is really firm, your sand wedge may not be the right club. Try your pitching wedge or fairway wedge because they have less bounce and will cut under and through the firm sand easier.
The proper technique for this shot is to open your stance with more weight on your front foot. Slightly open the club face at address. Take the club away outside your line with no weight shift. Cock your wrists quickly.
The downswing should be from the outside in across your line. Make sure you knock the sand out of the bunker. This will assure you of the ball coming out.
Soft sand is not a whole lot different. You should use a heavier wedge such as a 56-degree or 60-degree because these wedges have more bounce and will not dig in too deeply behind the ball.
The technique is the same for soft sand, except you don't need to cock your wrists as quickly as when you are in firm sand.
Remember, knock the sand out of the bunker and finish your swing.