Practical Effects are used some of the time.
It's cheaper and easier to hide the body and use a fake double, than it is to use CGI or anything else.
From Iron Man:
Notice the false bottom of the chair, and RDJ's body hidden away.
You can see in this pic They first created a prosthetic chest over his real chest and spray tanned it to match his original skin tone. Then they put in his "heart" so it would look like it's actually a hole in his chest while his actual chest is underneath it.
Shamelessly grabbed from How did they create the hole in Robert Downey Jr.'s chest for the Iron Man movie?
Of course, that's not always the case. CGI:
New Robocop used CGI to overlay a brain surgery scene:
In the ensuing surgery shots we see Murphy’s exposed brain. “It was a really fun shot” says Compositing Supervisor Adrian. “There was a certain playful element of adding bits of goo that came off the tweezers, it’s all CG and it just looks gross.
-Framestore, the Digital Effects company that worked on Robocop
And Prometheus used both.
Notice how she's sitting, same as RDJ above. Her head is weirdly angled.
I assembled & sculpted this body from lifecasts of Noomi Rapace and from this we made a silicone body which ends below the actress' own arms. It was used for a sequence in PROMETHEUS in which surgery needs to be carried out on Elizabeth Shaw. The stomach was manipulated from underneath and the wound could open and close mechanically, with VFX adding robotic surgical arms in post and blending the top edge of the body to Noomi Rapace's own chest.
-WALDO MASON EFFECTS, on Prometheus. Check out his gallery for more effects in other movies. Warning, Gore.
It highly depends on the end result wanted.
A chest or leg scene is easier in practical effects, while the brain scene with the actor's face right there is easier in CGI. Most of the time, they would use a partition, and just merge two shots, one of a fake, and one of the real together, as a composite. But CGI can always be added for some particularly specific details.
From the scene in question, the self leg surgery, notice how all the surgery parts are close tight shots, quick, with a shaky camera, and at an angle. They use film techniques to hide the real effects.
A more compelling surgery is done in "Wilson's Heart", where House gets brain surgery to recover memories. The scenes of his face are shot face on, while the scenes with his brain are done from above, hiding his face. They use a fake brain prop. The "partition" being the brace around his head.