I know it's been quite a while, but I made a SQL Server procedure that can help you. It returns the correlation of a dataset (Pearson Correlation Coefficient or Spearman Rank Correlation Coefficient) https://github.com/oscar-be/SQLServerStuff/blob/master/Data%20Analysis%20and%20Statistics/DATA_ANALYSIS_CORRELATION.sql