Two year olds often can't understand the consequences of their actions. Even if they can understand that doesn't mean they have the impulse control to stop.

I know it is exhausting but the reality is that two year olds, especially intense ones, require constant supervision. You can also lower your stress by doing what you can to alter the environment (locks high up on doors, putting some breakables away into storage for a while.) Some errands may need to be let go or reserved for time without the child. These are temporary changes and there is no reason to try to force the child to learn the lesson right now. He will get it when he's ready and in the meantime you can make life easier for everyone by taking some steps to change the environment.

I would also encourage you to plan ahead to find ways to keep your child engaged and set him up for success. Providing appropriate approved outlets for sensory play may help him meet that need without getting into flour, etc. Sensory play can include - water in the bathtub, a rubbermaid container filled with beans and toys like matchbox cars, playdough and clay, and the sandbox. Many two year olds enjoy a bucket of water, a paintbrush and some sidewalk. The sprinkler also saved our sanity around that age. Limited choices may also be helpful if your child is very verbal. Give two choices that are okay with you - "do you want to hold my hand or my purse", "while we wait do you want to hop up and down or sing a song?" etc.

It is good you've realized spanking doesn't work. I would encourage you right now to make the decision to never spank again. It doesn't work. The Natural Child Project has several good short articles that might help give you some good ideas. http://www.naturalchild.org/jan_hunt/22_alternatives.html
http://www.naturalchild.org/jan_hunt/tenreasons.html