1. Sometimes he painted in his studio based on the sketches he drew outside.

2. Based on the sketches he drew outside, sometimes he painted in his studio.

3. Being based on the sketches he drew outside, sometimes he painted in his studio.

4. As he was based on the sketches he drew outside, sometimes he painted in his studio.

5. While he was based on the sketches he drew outside, sometimes he painted in his studio.

(Are they all grammatical and the same?)

No, some of them don't make good sense.

#1 is the best.

#2 is OK.

#3-#5 should not be used.