How to change isKinematic only in one scene C#

Hello. If I have prefab with checked Is Kinematic how can I change this value in one scene, where I use this prefab? Using the C# script.
Could you give me some advice?

Lets say you have 4 scenes - Level1, Level2, Level3 and Level4. They are indexed 0 through 3. Lets say that you want to uncheck “Is Kinematic” on Level2 only, here are two possible ways

public GameObject myPrefab; // the prefab must have a Ridgidbody attached

GameObject go = (GameObject)Instantiate (myPrefab, transform.position, Quaternion.identity);
Rigidbody rb = go.GetComponent<Rigidbody>();
rb.isKinematic = (SceneManager.GetActiveScene().buildIndex != 1);

or you can do it this way

public Rigidbody myPrefab; // the prefab must have a Ridgidbody attached

Rigidbody rb = (Rigidbody)Instantiate (myPrefab, transform.position, Quaternion.identity);
myPrefab.isKinematic = (SceneManager.GetActiveScene().buildIndex != 1);