I live in an apartment and my dog is able to pee on the potty pad almost consistently. However, when it comes to pooping, he only does it when I'm not watching. I think this is a byproduct of me scolding him a couple of times long time ago when he was pooping on the sofa. How can I correct this behavior to get him poop on the potty pad?
Limit the available area to him when you are not directly supervising him. You can purchase exercise pens (image in this answer) in heights from 2 feet to 4 feet get a pen high enough that he won't jump out. One pen will make an area 4 feet by 4 feet, which if you have a small dog should be fine.
Put his bed on onside and potty pads on the other. His only options will be to poop on the pads or on his bed. "Hopefully" he will choose the potty pads. Reward him with praise when you get home and find he did his business in the correct place. After a few days (3-7) when you feel he has gotten the idea, expand the space so there is empty floor, a bed and potty pads. If he has understood the lesson he will continue to use the potty pads.
Once the lesson is learned, you should be able to allow him access to the whole house again. If he starts pooping off the pads again, put him back in the small area and teach the lesson again.