A little background: I adopted my adult miniature poodle Milo back in Feb. 2015. When I first had him, he would have accidents ONLY when I was gone and put him in his crate. Sometimes he would be alone for 5 hours and be fine; sometimes I would leave him for half an hour and he would pee, usually by lifting his leg to go OUTSIDE the crate. I tried to walk him every time before I left so he wouldn't have much pee left, and somehow I broke his habit after a few weeks. Over the course of a year after that, he probably only had an accident once or twice. He was even fine when I left him in the crate at houses of friends and family.
Flash forward to a little over a week ago (Monday the 18th). I normally come home on my lunch break, but I had to leave Milo for 10 hours because my car was in the shop. I had left him alone for that long on several occasions before when there was no way to avoid it, and he was fine. But that day he had an accident. Then he had an accident again on Tuesday, Thursday, Saturday, Sunday, Monday, Tuesday, and Wednesday. This whole time of course, I tried my previous method of walking him around as much as possible before I put him in the crate and clean it up REALLY well so he won't want to pee in the same spot.
In most cases he was fine when I came home at lunch, but had peed in the evening. The only exception was this Wednesday (yesterday) when he peed in the morning. I didn't have time to clean it up properly, so I stuck him in the bathroom, and he was fine. I thought maybe if I put him in the bathroom for a few days he might "break the habit" of peeing in his crate, but I came home this evening and he had peed in the bathroom, too (I had taped a garbage bag on the door to protect it from scatching, which he tore off and peed on; he didn't pee on anything else).
I don't know if it makes a difference, but he has separation anxiety (shakes violently everytime I leave), and I live in an apartment complex so there is plenty of noise. How do I get rid of this year-old habit?