It depends on the conditions.
For actual conditions:
The FAA addresses this in this letter of interpretation: (see full letter for the whole explanation)
QUESTION: Am I correct in understating that a CFII may log approaches
that a student flies when those approaches are conducted in actual
[IMC]?
ANSWER: Ref 61.51 Yes, a CFII may log approaches that a student flies
when those approaches are in actual [IMC].
...
The Chief Counsel's office agrees that the earlier guidance reflects
the appropriate interpretation of the regulation.
For Simulated VFR conditions:
If the student is flying under the hood in VFR conditions the Instructor may not log in the time also based on 61.51. Instructors may only log instrument time in actual conditions.
(g)Logging instrument time.
(1) A person may log instrument time only for that flight time when
the person operates the aircraft solely by reference to instruments
under actual or simulated instrument flight conditions.
(2) An authorized instructor may log instrument time when conducting
instrument flight instruction in actual instrument flight conditions.
(3) For the purposes of logging instrument time to meet the recent
instrument experience requirements of § 61.57(c) of this part, the
following information must be recorded in the person's logbook -
(i) The location and type of each instrument approach accomplished;
and
(ii) The name of the safety pilot, if required.
Most GA sims I have encountered can only be used by one person at a time. The CFII is there to observe and advise but cant really "take over"
(4) A person may use time in a full flight simulator, flight training
device, or aviation training device for acquiring instrument
aeronautical experience for a pilot certificate or rating provided an
authorized instructor is present to observe that time and signs the
person's logbook or training record to verify the time and the content
of the training session.