The Safe rename refactor ignores table columns in JOIN clauses and generates incorrect refactoring script

Applies to
ApexSQL Refactor

Summary
This article explains the issue when renaming a table column used in the JOIN clause and executing the created refactoring script.

Symptoms
A table column is referenced in the JOIN clause of another object (stored procedure, view, user-defined function):

CREATE PROCEDURE dbo.uspArticle
AS
BEGIN

SELECT
 a1.ArticleID 
,a1.ArticleMonthlyContent
,a2.ArticleWeeklyContent
FROM dbo.ArticleMonth a1
INNER JOIN dbo.ArticleWeek a2 
ON a1.ArticleID=a2.ArticleID
END 

If a table column is refactored using the Smart rename feature a column will not be renamed in the JOIN clause:

Smart rename column dialog - column will not be renamed in the JOIN clause

When the user tries to execute the generated script by clicking the Rename now button, the execution will fail:

Script execution results dialog - execution failed

Background
Due to a bug in the ApexSQL Refactor, refactored table columns were ignored in join clauses and the generated script execution would fail.

Affected versions:
ApexSQL Refactor 2013.04.0050 and older

Resolution
This issue has been solved in the latest ApexSQL Refactor that can be downloaded from here