Cats like nice soft soil that's easy to dig in to and room to manoeuvre, so you need to make this unattractive to them.
What I do, although it doesn't look very nice, is chop up cheap old bamboo canes into about 1 foot lengths and push them into the ground about a foot apart or less with about 6 inches sticking out of the ground. It doesn't give the cat much room to dig and squat with the canes in the way.
I also leave thorny prunings from shrubs around the place as they don't like these either.
If this doesn't appeal to you then the advice in the post above is sound but you don't need to get a cat. I use 'Silent Roar' which a lot of people will tell you doesn't work.
It does work, providing you are patient. I get it from the garden centre or online and it's not cheap at about £7 a box. It's pellets coated in essence of Lion dung and you spread it around thickly all over your soil. A cat will compete with it initially, perhaps up to two weeks, then all of a sudden you will notice the cat leaves your garden alone as it senses a bigger cat has taken up lodgings, and will stay away for at least 6 months before you need to reapply.
If your garden is very big then 1 box might not be enough, that's why I also use the canes or any twiggy sticks really would do, shoved into the soil.
Unfortunately it's an ongoing process.
oh, I've just noticed the post above mine submitted at the same time, also mentions the Lion dung. So there you go