It is not correct to perform standardization before splitting the data. In general, you should not fit any preprocessing algorithm (PCA, StandardScaler...) on the whole dataset, but only on the training set, and use the fitted algorithm to transform the test set.
Thus, none of the two experiences you propose are correct. What you should do is:
scaler = StandardScaler().fit(X_train)
train_sc = scaler.transform(X_train)
test_sc = scaler.transform(X_test)
It is easy to understand if you think of it this way: the test set is used to get an estimate of the performance of the model on unseen data. So you should behave as if you didn't have access to the test set while training the algorithm, and this is also valid for cross validation.
When you fit the standard scaler on the whole dataset, information from the test set is used to normalize the training set. This is a common case of "data leakage", which means that information from the test set is used while training the model. This often results in overestimates of the model's performance.
Note that in scikit-learn you can use Pipelines in order to chain the preprocessing steps with the estimator, and use it in the cross validation process. This will ensure that the same steps are repeated for each folds of the cross validation process.