Respiration causes time-varying frequency offsets that can result in ghosting artifacts. We propose a solution, which we term dynamic realtime z-shimming, wherein linear gradients are adjusted dynamically (slice-wise) and in real-time, to reflect magnetic field inhomogeneities that arise during image acquisition. In dynamic z-shimming, a method that is commonly used to reduce static frequency offsets in MR images of the spinal cord and brain, in-plane (static) frequency offsets are assumed to be homogeneous. Here we investigate whether or not that same assumption can be made for time-varying frequency offsets in the cervical spinal cord region. In order to explore the feasibility of dynamic realtime z-shimming, we acquired images using a pneumatic phantom setup, as well as in-vivo. We then simulated the effects of time-varying frequency offsets on MR images acquired with and without dynamic realtime z-shimming in different scenarios. We found that dynamic realtime z-shimming can reduce ghosting if the time-varying frequency offsets have an in-plane variability (standard deviation) of approximately less than 1 Hz. This scenario was achieved in our phantom setup, where we observed a 50.2% reduction in ghosting within multi-echo gradient echo images acquired with dynamic realtime z-shimming, compared to without. On the other hand, we observed that the in-plane variability of the time-varying frequency offsets is too high within the cervical spinal cord region for dynamic realtime z-shimming to be successful. These results can serve as a guideline and starting point for future dynamic realtime z-shimming experiments in which the in-plane variability of frequency offsets are minimized.