One simple solution with np.where:
for i in range(2, 4): df[f"V{i}"] = np.where(df["X"] == i, 9, df[f"V{i}"])